import store from '@/store'

const permission = {
  inserted(el, binding, vnode) {
    const { value } = binding
    const { permissions } = store.state
    if (permissions.indexOf(value) === -1) {
      // el.parentNode && el.parentNode.removeChild(el)
    }
  }
}

const install = function(Vue) {
  Vue.directive('permission', permission)
}

export default {
  install
}
